<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script>
			var radom = parseInt(Math.random() * 100 + 1);
			function guess(){
				var num = document.getElementById("num1").value;
				var result = document.getElementById("result");
				if (num == radom) {
					result.innerHTML = "恭喜你猜对了";
				}
				if (num > radom) {
					result.innerHTML = "大了";
				}
				if (num < radom) {
					result.innerHTML = "小了";
				}
			}
		</script>
		<input type="text" id="num1">
		&nbsp;
		<input type="button" value="猜" onclick="guess()">
		<span id="result"></span>
	</body>
</html>
